from connect.conn_mysql import Connect

class InsertMsg(Connect):

    def insert_info(self,start_point,destination,start_time,
                        pick_up_point,people_number,user_id):
        '''插入用户提交乘车信息的函数'''
        insert_sql = '''
        insert into message(
                start_point,destination,start_time,
                pick_up_point,people_number,user_id
        )
        values(%s,%s,%s,%s,%s,%s)
        '''
        id = self.insert(insert_sql,(start_point,destination,start_time,
                                pick_up_point,people_number,user_id))

    def messages(self):
        result = '请求提交成功'
        return result
    def return_message(self,start_point,destination,start_time,pick_up_point,people_number):
        if all([start_point,destination,start_time,pick_up_point,people_number]):

            return {
            'status':1,
            'errorCode':66,
            'errorMsg':66,
            'resultBody':f'您在{start_point}上车,在{destination}下车,您的预约时间{start_time}你的上车地点{pick_up_point},您能接受的拼车人数是{people_number}.'
                }       